// import config from '../config/main';
import Kutil from '../tool/Kutil';
import inquirer from 'inquirer';


const kutil = new Kutil();

function validate() {
    return (value) => {
        const valid = value !== '';
        return valid || '不能为空';
    };
}

function* test(message) {
    console.log('--------------');

    // const uri = 'http://wx.qlogo.cn/mmopen/' +
    // 'UKZAr3AckpACDrX0icuicQyHJs8h04IpeqQUltRRbguMY9' +
    // 'cpR8m96gRVjwxKpj63JUiaC4JEWMQxUiaNfCejLt7lqJovMDOTatzN/0';
    // const isOk = yield kutil.downloadImgSyncStream(uri, `${config.baseDir}/orig`, 'img.jpg');

    console.log('--------------');
    // console.log(isOk);
    // console.log(message);

    console.log(kutil.convertNumToLet(message));
}

function* input() {
    const ans = yield inquirer.prompt([
        {
            type: 'input',
            name: 'message',
            message: '请输入 test message: ',
            validate: validate(),
        },
    ]);
    yield test(ans.message);
}

const main = input;

export default main;
